#ifndef __COMMU_H__
#define __COMMU_H__
#include "gd32f10x.h"

#define COMM_BUFFSIZE		512

#define COMM_485_DIR_PORT	GPIOA
#define COMM_485_DIR_PIN	GPIO_PIN_7

#define COMM_DIR_SEND()		gpio_bit_set(COMM_485_DIR_PORT, COMM_485_DIR_PIN);
#define COMM_DIR_RECV()		gpio_bit_reset(COMM_485_DIR_PORT, COMM_485_DIR_PIN);

struct COMM
{
	uint8_t buf[COMM_BUFFSIZE];
	uint16_t len;
};
void comm_uart_init(void);
void comm_send_bytes(uint8_t *buf, uint16_t len);
void comm_receiver_process(void);
void comm_sender_process(void);
#endif
